<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--<!DOCTYPE html>--%>
<%--<html lang="en">--%>
<head>
    <title>商品列表</title>
    <script>
        function shopId(shopId,categoryId){
            <%--console.log("shopId="+shopId+",categoryId="+categoryId);--%>
            <%--console.log("${ctx}/classification?categoryId="+categoryId+"&shopId="+shopId);--%>
            $.get("${ctx}/classification?categoryId="+categoryId+"&shopId="+shopId,
                    function(json){
//                        var obj=JSON.parse(json);
                        $(".ws-category-style-1 li").remove();
                        var myHtml="";
                        for(var i=0;i<json.length;i++){
                            myHtml = myHtml + "<li><a href='#'><img src='"+json[i].productMainImage+"'/><span>"+json[i].productName+"</span></a><li>";
                        }
                        $(".ws-category-style-1").html(myHtml);
//                      console.log(obj[0].productName);
                    },"json");
        }
    </script>
</head>
<body>
<c:choose>
    <c:when test="${category==1}">
<form  method="get" action="${ctx}/${shopId}/list">
    <div class="layout_search_head ptb10_lr30 b-f1f1f1">
        <div class="search_mian lh1-5 r10">
            <i class="ico-30 ico_search"></i>
            <input class="i_text" type="text"  id="productName" name="productName" value="${productName}" placeholder="搜索商品名称">
        </div>
    </div>
    </form>
        没有找到相关商品您可以换个词再试试
    </c:when>
    <c:when test="${category==0}">
        <form  method="get" action="${ctx}/${shopId}/list">
            <div class="layout_search_head ptb10_lr30 b-f1f1f1">
                <div class="search_mian lh1-5 r10">
                    <i class="ico-30 ico_search"></i>
                    <input class="i_text" type="text"  id="productName" name="productName" value="${productName}" placeholder="搜索商品名称">
                </div>
            </div>
            <c:forEach var="item" items="${categoryList}">
                <div id="categoryBody" class="category-viewport">
                    <div id="rootList" class="ws-category-tab">

                        <c:choose>
                            <c:when test="${PProduct==0}">
                                <c:forEach var="ite" items="${categoryList}">
                                    <li ><i></i><a onClick="shopId('${ite.shopId}','${ite.categoryId}')">${ite.categoryName}</a></li>
                                </c:forEach>
                            </c:when>
                            <c:when test="${PProduct==1}">
                                <li ><i></i><a  onClick="shopId('${wxShopCategory.shopId}','${wxShopCategory.categoryId}')">${wxShopCategory.categoryName}</a></li>
                            </c:when>
                        </c:choose>
                    </div>
                    <div class="ws-category-content">
                        <div class="ws-category-div curr">
                            <h4 class="fs24 lh2 plr20"></h4>
                            <ul class="ws-category-style-1" >
                                <c:choose>
                                    <c:when test="${PProduct==1}">
                                        <c:forEach var="ite" items="${pProductList}">
                                            <li> <a href="#"><img src="${ite.productMainImage}"><span>${ite.productName}</span></a></li>
                                        </c:forEach>
                                    </c:when>
                                    <c:when test="${PProduct==0}">
                                        <c:forEach var="ite" items="${pProduct}">
                                            <li> <a href="#"><img src="${ite.productMainImage}"><span>${ite.productName}</span></a></li>
                                        </c:forEach>
                                    </c:when>
                                </c:choose>
                            </ul>
                        </div>
                    </div>
                </div>
            </c:forEach>
        </form>
    </c:when>
</c:choose>

<script type="text/javascript">
    $.Dashentab(".ws-category-tab","li",".ws-category-content",".ws-category-div","curr","click",0);
    function w_h(){
        $("body").css({"overflow":"hidden"})
        var h = $(window).innerHeight();
        var th = $(".layout_search_head").innerHeight();
        var rh = $("header").innerHeight();
        $("body").height(h + "px");
        $("#categoryBody,.ws-category-content,#rootList").height(h - th -rh + "px");
    }
    $(function(){
        w_h();
    })
    $(window).resize(function(){
        w_h();
    })
</script>
</body>
</html>